<template>
  <v-snackbar
    v-model="isVisible"
    :color="type"
    :timeout="timeout"
    top
    right
  >
    {{ text }}
    <v-btn
      dark
      flat
      @click="hide"
    >
      <v-icon dark>close</v-icon>
    </v-btn>
  </v-snackbar>
</template>

<script>
export default {
  name: 'Snackbar',
  props: {
    type: {
      type: String,
      default: 'success'
    },
    text: {
      type: String,
      default: ''
    },
    timeout: {
      type: Number,
      default: 3000
    }
  },
  data() {
    return {
      isVisible: false
    }
  },
  methods: {
    show() {
      this.isVisible = true
    },
    hide() {
      this.isVisible = false
    }
  }
}
</script>
